package com.weng.cloud.starter.batch.listener;

import com.weng.cloud.commons.base.JsonUtil;
import org.springframework.batch.core.ItemReadListener;

/**
 * @Author: weng
 * @Date: 2022/3/20
 * @Description: com.weng.cloud.starter.batch.listener
 */
public class LogItemReadListener<T> implements ItemReadListener<T> {
    @Override
    public void beforeRead() {
        System.out.println("行读取开始");
    }

    @Override
    public void afterRead(T t) {
        System.out.println("行读取结束,参数 => "+ JsonUtil.toText(t));
    }

    @Override
    public void onReadError(Exception e) {
        System.err.println("行读取异常！！！ "+e.getMessage());
    }
}
